<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<style>
  .active{
    color:red;
  }
  .size{
    font-size: 30px;
  }
  .family{
    font-family: 宋体;
  }
</style>
<body>
<!--引入vue-->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<div id="app">
  <h2 class="size" v-bind:class="getClasses()">{{message}}</h2>
  <button v-on:click="btnClickActive">切换颜色</button>
  <button v-on:click="btnClickSize">切换字体风格</button>
</div>
<script>
  const app = new Vue({
    el: "#app",
    data:{
      message:"Hello zk I am Vue !",
      isActive:true,
      isFamily:false
    },
    methods: {
      btnClickActive:function () {
        this.isActive=!this.isActive
      },
      btnClickSize:function () {
        this.isFamily=!this.isFamily
      },
      getClasses:function () {
        return{active:this.isActive,family:this.isFamily}
      }
    }
  })
</script>
</body>
</html>
